package com.fjec.market.controller;

import com.fjec.common.protocol.JsonResult;
import com.fjec.market.entity.InfoPurchase;
import com.fjec.market.service.IInfoPurchaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 006.采购商表 前端控制器
 * </p>
 *
 * @author admin
 * @since 2020-09-07
 */
@RestController
@RequestMapping("/")
public class InfoPurchaseController {

    @Autowired
    private IInfoPurchaseService infoPurchaseService;

    @GetMapping("/y/purchase/getByUserId")
    public JsonResult getPurchaseByUserId(Long userId) {
        return JsonResult.success().data(infoPurchaseService.getPurchaseByUserId(userId)).build();
    }

    @PostMapping(value = "/y/purchase/save")
    public JsonResult savePurchase(InfoPurchase purchase, String markCodes, Long picId, Long headPicId, String verifyCode) {
        return infoPurchaseService.savePurchase(purchase, markCodes, picId, headPicId, verifyCode);
    }
}
